﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAO_DTO_WS.DAO;
using DAO_DTO_WS.DTO;

namespace LayoutTemplate
{
    public partial class ThongTinCaNhan : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int quyen = (int)Session["TinhTrang"];
            if (quyen == -1)
                Response.Redirect("TrangLoi.aspx?Error=2");
            if ((quyen == 1) || (quyen == 3))
            {

            }
            else
            {
                Response.Redirect("TrangChu.aspx");
            }
            
        }

        protected void btnCapNhat_Click(object sender, EventArgs e)
        {
            ThanhVienDTO thanhvien = ThanhVienDAO.LayThanhVien(Session["TenDangNhap"].ToString());
            if (string.Compare(tbHoTen.Text, string.Empty, true) != 0)
                thanhvien.HoTen = tbHoTen.Text;
            if (string.Compare(tbNgaySinh.Text , string.Empty,true)!=0)
                thanhvien.NgaySinh = Convert.ToDateTime(tbNgaySinh.Text);
            
            if (string.Compare(tbDienThoai.Text,string.Empty,true)!=0)
                thanhvien.DienThoai = tbDienThoai.Text;
            
            if (string.Compare(tbNoiO.Text , string.Empty,true)!=0)
                thanhvien.NoiO = tbNoiO.Text;
           
         
          
            ThanhVienDAO.SuaTV(thanhvien);
        }
    }
}
